#ifndef _SERVO_H
#define _SERVO_H
#include <zephyr/drivers/pwm.h>
#include <zephyr/drivers/i2c.h>

typedef struct __attribute__ ((__packed__)){
    float servo_head_x;  //单位 角度0-180
    float servo_head_y;
    float servo_fin_left_out;
    float servo_fin_left_in;
    float servo_fin_right_in;
    float servo_fin_right_out;
}Servo_Ctr;

typedef struct __attribute__ ((__packed__)){
    float servo_head_x;  //单位 角度0-180
    float servo_head_y;
    float servo_fin_left_out;
    float servo_fin_left_in;
    float servo_fin_right_in;
    float servo_fin_right_out;
}Servo_Sta;

#define min_pulse                   500U
#define max_pulse                   2500U



int Servo_init(void);
void Servo_angle_init_cg(Servo_Ctr servo_init_angle_val);
int Servo_ctr_single(uint8_t servo_num,float angle);
int Servo_ctr_API(Servo_Ctr servo_val);
const struct pwm_dt_spec* find_pwmdt_by_num(uint8_t servo_num);
#endif
